Skip to content

fix(widgets): table row selection shows full background color#120

Merged
mathiasbourgoin merged 1 commit intomainfrom
fix/table-row-selection-highlighting
Feb 23, 2026
Merged

fix(widgets): table row selection shows full background color#120
mathiasbourgoin merged 1 commit intomainfrom
fix/table-row-selection-highlighting

Conversation

@vch9
Copy link
Collaborator

@vch9 vch9 commented Feb 23, 2026

Summary

Fixes table row selection highlighting to display full background color across the entire row when selection_mode = Row.

Problem

When navigating through a table with row selection enabled, only the vertical border characters () between columns displayed the selection background color. The cell contents remained unstyled, making it difficult to see which row was selected.

Root cause: Each border character was styled with themed_border, which adds ANSI codes ending with \033[0m (reset all formatting). When themed_selection wrapped the entire assembled row, these reset codes cleared the selection background for all content between borders.

Solution

  • Pass ~is_selected flag to assemble_columns() function
  • When is_selected = true, render border characters as plain text (no themed_border)
  • Border characters now inherit the selection background applied to the full row
  • Applied to both wrapped and non-wrapped rendering paths

Testing

You can test the fix with the table demo:

```bash
cd path/to/miaou
dune exec example/demos/table/main.exe
```

Use Up/Down arrows to navigate between rows. You should see the entire selected row with a colored background, not just the vertical separators.

  • All existing tests pass (dune runtest)
  • Verified compilation with dune build)
  • Manual testing with table demo shows full row highlighting

Version Bump

  • Version bumped from 0.4.0 to 0.4.1 (bug fix release)
  • CHANGELOG.md updated with new [0.4.1] section
  • All opam files regenerated with new version

Checklist

  • Code compiles without warnings
  • All tests pass
  • CHANGELOG.md updated
  • Version bumped appropriately
  • Commit message follows conventional format
  • Change is backward compatible (no API changes)

@vch9 vch9 force-pushed the fix/table-row-selection-highlighting branch from 605cbff to 01c62b2 Compare February 23, 2026 09:28
@mathiasbourgoin mathiasbourgoin force-pushed the fix/table-row-selection-highlighting branch from 01c62b2 to 0bde150 Compare February 23, 2026 22:08
When selection_mode = Row, the entire row should display the selection
background color. Previously, only the vertical border characters (│)
showed the selection color because:

1. assemble_columns() applied themed_border to each vline separator
2. Each themed_border adds ANSI codes with \033[0m reset suffix
3. themed_selection wraps the assembled row, but reset codes inside
   clear the selection background
4. Result: only vlines show selection; cell content loses background

Fix: Pass ~is_selected flag to assemble_columns. When true, vlines are
rendered without themed_border styling, allowing them to inherit the
selection background applied to the full row.

This affects both wrapped and non-wrapped table rendering paths.

BREAKING CHANGE: Bumps version to 0.4.1 for bug fix release.
@mathiasbourgoin mathiasbourgoin force-pushed the fix/table-row-selection-highlighting branch from 0bde150 to 19e7361 Compare February 23, 2026 22:27
@mathiasbourgoin mathiasbourgoin merged commit c51e182 into main Feb 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants